﻿<?xml version="1.0" encoding="utf-8" ?>
<Rules FriendlyName="Jsl Rules">
  <Rule TypeName="BackingFieldShouldHaveSameNameAsProperty" Category="Jsl.Application" CheckId="BackingFieldShouldHaveSameNameAsProperty">
    <Name>Use same name for field as property</Name>
    <Description>The backing field for a property has a different name then the property.</Description>
    <Url>http://www.codeplex.com/JslFxCop/Wiki/View.aspx?title=BackingFieldShouldHaveSameNameAsProperty</Url>
    <Resolution Name="OneFound">The property is named '{0}' and the probable backing field is named '{1}'. Choose which name better describes the value and use it for the property and the backing field.</Resolution>
    <Resolution Name="MultipleFound">The property is named '{0}' and has many potential backing fields. Choose which name better describes the value and use it for the property and the backing field.</Resolution>
    <MessageLevel Certainty="75">Warning</MessageLevel>
    <Email/>
    <FixCategories>NonBreaking</FixCategories>
    <Owner>Jeff LeBert</Owner>
  </Rule>
  <Rule TypeName="CallBaseDispose" Category="Jsl.Application" CheckId="CallBaseDispose">
    <Name>Dispose methods should call base.Dispose</Name>
    <Description>Overrides of the Dispose method should call base.Dispose.</Description>
    <Url>http://www.codeplex.com/JSLFxCop/Wiki/View.aspx?title=CallBaseDispose</Url>
    <Resolution>Add a call to base.Dispose as the last line of the method.</Resolution>
    <MessageLevel Certainty="100">Error</MessageLevel>
    <Email/>
    <FixCategories>NonBreaking</FixCategories>
    <Owner>Jeff LeBert</Owner>
  </Rule>
  <Rule TypeName="CallComponentsDispose" Category="Jsl.Application" CheckId="CallComponentsDispose">
    <Name>Dispose the components field</Name>
    <Description>Dispose should always be called on the components field.</Description>
    <Url>http://www.codeplex.com/JSLFxCop/Wiki/View.aspx?title=CallComponentsDispose</Url>
    <Resolution Name="MissingDisposeMethod">Override the Dispose method and call components.Dispose.</Resolution>
    <Resolution Name="OnlyOneDispose">There should only be one call to dispose the components field.</Resolution>
    <Resolution Name="MustCheckComponentsNull">You must check that the components field is not null before disposing it.</Resolution>
    <Resolution Name="DontUseComponents">The components field is never created and never disposed so it shouldn't be used in the Dispose(bool) method.</Resolution>
    <Resolution Name="MustDisposeComponents">Modify the code to dispose the components field like this:
if (disposing)
{
  if (this.components != null)
  {
    this.components.Dispose();
  }
}</Resolution>
    <Resolution Name="DisposeShouldBeOnlyStatement">The this.components.Dispose() should be the only thing in an if statement:
if (disposing)
{
  if (this.components != null)
  {
    this.components.Dispose();
  }
}</Resolution>
    <MessageLevel Certainty="100">Error</MessageLevel>
    <Email/>
    <FixCategories>NonBreaking</FixCategories>
    <Owner>Jeff LeBert</Owner>
  </Rule>
  <Rule TypeName="ComponentsShouldBeLocalizable" Category="Jsl.UI" CheckId="ComponentsShouldBeLocalizable">
    <Name>Components should be localizable</Name>
    <Description>Components such as WinForms and UserControls should have their Localizable flag set to true in the designer.</Description>
    <Url>http://www.codeplex.com/JslFxCop/Wiki/View.aspx?title=ComponentsShouldBeLocalizable</Url>
    <Resolution>Set the Localizable flag to true.</Resolution>
    <MessageLevel Certainty="75">Warning</MessageLevel>
    <Email/>
    <FixCategories>NonBreaking</FixCategories>
    <Owner>Jeff LeBert</Owner>
  </Rule>
  <Rule TypeName="FixSimplePerformanceChanges" Category="Jsl.Application" CheckId="FixSimplePerformanceChanges">
    <Name>Simple performance changes</Name>
    <Description>Finds a bunch of simple performance changes that can be made.</Description>
    <Url>http://www.codeplex.com/JslFxCop/Wiki/View.aspx?title=DoNotUseToStringOnAString</Url>
    <Resolution Name="String.ToString">Remove the call to ToString since the object is already a string.</Resolution>
    <Resolution Name="NewEventArgs">Use EventArgs.Empty instead of creating a new EventArgs instance.</Resolution>
    <MessageLevel Certainty="100">Warning</MessageLevel>
    <Email/>
    <FixCategories>NonBreaking</FixCategories>
    <Owner>Jeff LeBert</Owner>
  </Rule>
  <Rule TypeName="FixInconsistentAttributes" Category="Jsl.Application" CheckId="FixInconsistentAttributes">
    <Name>Fix inconsistent attribute</Name>
    <Description>There are many attributes that don't go together. For example, if a property has the [Browsable(false)] attribute, it doesn't need a [Category] attribute.</Description>
    <Url>http://jslfxcop.codeplex.com/Wiki/View.aspx?title=FixInconsistentAttributes</Url>
    <Resolution Name="RemoveTheAttributeFromNonComponent">Remove the {0} attribute from the '{1}' member since the class isn't a component.</Resolution>
    <Resolution Name="RemoveAttributeWhenBrowsableFalse">Remove the {0} attribute from the '{1}' member since it is Browsable(false).</Resolution>
    <Resolution Name="RemoveAttributeWhenHidden">Remove the {0} attribute from the '{1}' member since it is DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden).</Resolution>
    <Resolution Name="RemoveAttributeWhenNonPublic">Remove the {0} attribute from the '{1}' member since the member is not public.</Resolution>
    <MessageLevel Certainty="100">Warning</MessageLevel>
    <Email/>
    <FixCategories>NonBreaking</FixCategories>
    <Owner>Jeff LeBert</Owner>
  </Rule>
  <Rule TypeName="FollowAccessibilityRules" Category="Jsl.UI" CheckId="FollowAccessibilityRules">
    <Name>Follow accessibility rules</Name>
    <Description>Design UI such that it can easily be accessed by visually impaired or blind users.</Description>
    <Url>http://www.codeplex.com/JslFxCop/Wiki/View.aspx?title=FollowAccessibilityRules</Url>
    <Resolution Name="FoundByTabIndex">Unable to find a sibling control to use for the AccessibleName for the '{0}' control. If you don't fix this then the '{1}' control will be used.</Resolution>
    <Resolution Name="FoundConflict">The sibling control '{0}' seems to be a better fit using its Location and Size than '{1}' does using TabIndex for the '{2}' control. If you don't change this than the '{1}' control will be used.</Resolution>
    <Resolution Name="FoundOneByLocation">Unable to find a sibling control to use for the AccessibleName for the '{0}' control. The '{1}' control seems to be the closest but needs its TabIndex set appropriately.</Resolution>
    <Resolution Name="NoAppropriateSibling">Unable to find a sibling control to use for the AccessibleName for the '{0}' control.</Resolution>
    <MessageLevel Certainty="95">Error</MessageLevel>
    <Email/>
    <FixCategories>NonBreaking</FixCategories>
    <Owner>Jeff LeBert</Owner>
  </Rule>
  <Rule TypeName="MarkFieldReadOnly" Category="Jsl.Application" CheckId="MarkFieldReadOnly">
    <Name>Mark Fields ReadOnly</Name>
    <Description>In C# fields that are only set in the constructor should be marked readonly.</Description>
    <Url>http://www.codeplex.com/JslFxCop/Wiki/View.aspx?title=MarkFieldReadOnly</Url>
    <Resolution Name="ReadOnly">Mark the field '{0}' as readonly.</Resolution>
    <Resolution Name="NeverSet">Remove the field '{0}' since it is never set and therefore is always the default value.</Resolution>
    <MessageLevel Certainty="75">Warning</MessageLevel>
    <Email/>
    <FixCategories>NonBreaking</FixCategories>
    <Owner>Jeff LeBert</Owner>
  </Rule>
  <Rule TypeName="RaiseEventsCorrectly" Category="Jsl.Application" CheckId="RaiseEventsCorrectly">
    <Name>Raise events correctly</Name>
    <Description>Raise events correctly to work in multithreaded cases.</Description>
    <Url>http://www.codeplex.com/JslFxCop/Wiki/View.aspx?title=RaiseEventsCorrectly</Url>
    <Resolution Name="CheckForNull">Check the event {0} for null before raising it.</Resolution>
    <Resolution Name="UseLocalVariable">Use a local variable to hold the raise the {0} event value. Check the local for null and raise the event from the local variable.</Resolution>
    <MessageLevel Certainty="90">Warning</MessageLevel>
    <Email/>
    <FixCategories>NonBreaking</FixCategories>
    <Owner>Jeff LeBert</Owner>
  </Rule>
  <Rule TypeName="ReferenceParametersShouldHaveTheirValuesSet" Category="Jsl.Application" CheckId="ReferenceParametersShouldHaveTheirValuesSet">
    <Name>Reference parameters must be set</Name>
    <Description>Parameters that are passed by reference should be set in the method. Otherwise they should be passed by value.</Description>
    <Url>http://www.codeplex.com/JslFxCop/Wiki/View.aspx?title=ReferenceParametersShouldHaveTheirValuesSet</Url>
    <Resolution>Pass the '{0}' parameter by value.</Resolution>
    <MessageLevel Certainty="100">Warning</MessageLevel>
    <Email/>
    <FixCategories>Breaking</FixCategories>
    <Owner>Jeff LeBert</Owner>
  </Rule>
  <Rule TypeName="RemoveEmptyEventHandlers" Category="Jsl.Application" CheckId="RemoveEmptyEventHandlers">
    <Name>Remove Empty Event Handlers</Name>
    <Description>Empty event handlers serve no purpose so they should be removed.</Description>
    <Url>http://www.codeplex.com/JslFxCop/Wiki/View.aspx?title=RemoveEmptyEventHandlers</Url>
    <Resolution>Remove the empty event handler {0} for the {1} event.</Resolution>
    <MessageLevel Certainty="90">Warning</MessageLevel>
    <Email/>
    <FixCategories>NonBreaking</FixCategories>
    <Owner>Jeff LeBert</Owner>
  </Rule>
  <Rule TypeName="RemoveEmptyTry" Category="Jsl.Application" CheckId="RemoveEmptyTry">
    <Name>Remove Empty Try</Name>
    <Description>Try/catch structures with nothing in the try will never execute the catch. Completely remove the try/catch structure.</Description>
    <Url>http://www.codeplex.com/JslFxCop/Wiki/View.aspx?title=RemoveEmptyTry</Url>
    <Resolution>Remove the unnecessary try/catch.</Resolution>
    <MessageLevel Certainty="100">Error</MessageLevel>
    <Email/>
    <FixCategories>NonBreaking</FixCategories>
    <Owner>Jeff LeBert</Owner>
  </Rule>
  <Rule TypeName="RemoveUselessCatch" Category="Jsl.Application" CheckId="RemoveUselessCatch">
    <Name>Remove useless catch handlers</Name>
    <Description>Catch handlers that only throw the exception are useless.</Description>
    <Url>http://www.codeplex.com/JslFxCop/Wiki/View.aspx?title=RemoveUselessCatch</Url>
    <Resolution>Remove the useless catch handler.</Resolution>
    <MessageLevel Certainty="100">Warning</MessageLevel>
    <Email/>
    <FixCategories>NonBreaking</FixCategories>
    <Owner>Jeff LeBert</Owner>
  </Rule>
  <Rule TypeName="TypecastingProblems" Category="Jsl.Application" CheckId="TypecastingProblems">
    <Name>Inefficient type casting</Name>
    <Description>Use a more efficient type casting.</Description>
    <Url>http://www.codeplex.com/JSLFxCop/Wiki/View.aspx?title=TypecastingProblems</Url>
    <Resolution Name="UseTypeOfWithName">Use 'typeof({0})' instead of 'type.GetType("{0}")'.</Resolution>
    <Resolution Name="UseAsWithName">Use '... as {0}' instead of 'type.GetInterface("{0}")'.</Resolution>
    <MessageLevel Certainty="90">Warning</MessageLevel>
    <Email />
    <FixCategories>NonBreaking</FixCategories>
    <Owner>Jeff LeBert</Owner>
  </Rule>
  <Rule TypeName="UseCharInsteadOfString" Category="Jsl.Application" CheckId="UseCharInsteadOfString">
    <Name>Use char instead of string</Name>
    <Description>Using char instead of a single character string is more efficient.</Description>
    <Url>http://www.codeplex.com/JSLFxCop/Wiki/View.aspx?title=UseCharInsteadOfString</Url>
    <Resolution Name="MultipleReplacement">Replace "{0}" and "{1}" string constants with '{0}' and '{1}' character constants.</Resolution>
    <Resolution Name="SingleReplacement">Replace "{0}" string constant with a '{0}' character constant.</Resolution>
    <Resolution Name="StringBuilderAppendRepeatedCharacters">Replace StringBuilder.Append("{0}") with StringBuilder.Append('{1}', {2}).</Resolution>
    <MessageLevel Certainty="100">Warning</MessageLevel>
    <Email />
    <FixCategories>NonBreaking</FixCategories>
    <Owner>Jeff LeBert</Owner>
  </Rule>
  <Rule TypeName="UseStrongestType" Category="Jsl.Application" CheckId="UseStrongestType">
    <Name>NOT WORKING YET! UseStrongestType</Name>
    <Description>NOT WORKING YET! Use strongest type (Debug builds only)</Description>
    <Url>http://www.codeplex.com/JSLFxCop/Wiki/View.aspx?title=UseStrongestType</Url>
    <Resolution Name="ChangeClassOrStruct">The variable '{0}' of type '{1}' should be changed to type '{2}'.</Resolution>
    <Resolution Name="ChangeToInterface">The variable '{0}' of type '{1}' should be changed to the following interface '{2}'.</Resolution>
    <Resolution Name="ChangeToInterfaces">The variable '{0}' of type '{1}' should be changed to one of the following interfaces '{2}'.</Resolution>
    <Resolution Name="Return">The return type '{0}' should be changed to '{1}'.</Resolution>
    <MessageLevel Certainty="100">Warning</MessageLevel>
    <Email />
    <FixCategories>NonBreaking</FixCategories>
    <Owner>Jeff LeBert</Owner>
  </Rule>
  <Rule TypeName="UseTypedDataSetFeatures" Category="Jsl.Application" CheckId="UseTypedDataSetFeatures">
    <Name>Use typed DataSet features</Name>
    <Description>Use typed DataSet features if available. For example, a typed DataSet with the table MyTable could be accessed like this: ds.Tables["MyTable"] but is better to access like this: ds.MyTable.</Description>
    <Url>http://www.codeplex.com/JSLFxCop/Wiki/View.aspx?title=UseTypedDataSetFeatures</Url>
    <Resolution Name="UseTableProperty">Use ds.{0} instead of ds.Tables["{0}"].</Resolution>
    <Resolution Name="UseTypedAddRow">Use table.Add{0}Row(row) instead of table.Rows.Add(row).</Resolution>
    <Resolution Name="UseTypedNewRow">Use table.New{0}Row() instead of table.NewRow().</Resolution>
    <Resolution Name="UseTypedRemoveRow">Use table.Remove{0}Row(row) instead of table.Rows.Remove(row).</Resolution>
    <MessageLevel Certainty="100">Warning</MessageLevel>
    <Email />
    <FixCategories>NonBreaking</FixCategories>
    <Owner>Jeff LeBert</Owner>
  </Rule>
</Rules>